package org.linlinjava.litemall.db.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.linlinjava.litemall.db.dao.IssueMapper;
import org.linlinjava.litemall.db.models.Issue;
import org.linlinjava.litemall.db.service.IssueService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class IssueServiceImpl extends ServiceImpl<IssueMapper, Issue>
        implements IssueService {

    @Override
    public IPage<Issue> querySelective(String question, Integer pageNo, Integer pageSize) {
        QueryWrapper<Issue> query = new QueryWrapper<>();
        query.like(!StringUtils.isEmpty(question), "question", question);

        Page<Issue> page = new Page<>(pageNo, pageSize);
        return this.baseMapper.selectPage(page, query);
    }

}
